package com.cloudfun.campusshare.repo;

import com.cloudfun.campusshare.entity.AuthorityEntity;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.Collection;
import java.util.List;

/**
 * Created by Huqin on 2020/5/7
 */
public interface AuthorityEntityRepo extends
        PagingAndSortingRepository<AuthorityEntity, String>,
        JpaSpecificationExecutor<AuthorityEntity> {

    @Query(value = "select * from authority where id in ?1 order by CAST(id as signed) asc",nativeQuery = true)
    List<AuthorityEntity> findAllByIdIn(Collection<String> ids);

    List<AuthorityEntity> findAll();

}
